import 'package:flutter/material.dart';
import '../pages/draw_layout.dart';


class DirectoryCard extends StatefulWidget {
  const DirectoryCard({Key? key}) : super(key: key);

  @override
  _DirectoryCardState createState() => _DirectoryCardState();
}

class _DirectoryCardState extends State<DirectoryCard> with SingleTickerProviderStateMixin{
  List<List> list = [
    ["包", "可回收垃圾"],
    ["报纸", "可回收垃圾"],
    ["笔", "其他(干)垃圾"],
    ["编织袋", "其他(干)垃圾"],
    ["玻璃窗", "可回收垃圾"],
    ["玻璃钢", "其他(干)垃圾"],
    ["玻璃瓶", "可回收垃圾"],
    ["菠萝蜜核", "其他(干)垃圾"],
    ["菜刀", "可回收垃圾"],
    ["茶叶渣/咖啡渣", "厨余(湿)垃圾"],
    ["充电宝/U盘", "可回收垃圾"],
    ["宠物饲料", "厨余(湿)垃圾"],
    ["床单", "可回收垃圾"],
    ["打火机", "其他(干)垃圾"],
    ["打印纸", "可回收垃圾"],
    ["大骨头", "其他(干)垃圾"],
    ["蛋", "厨余(湿)垃圾"],
    ["蛋壳", "厨余(湿)垃圾"],
    ["刀片", "可回收垃圾"],
    ["灯管", "有害垃圾"],
    ["电池", "有害垃圾"],
    ["电路板", "可回收垃圾"],
    ["电线", "可回收垃圾"],
    ["调料/酱料", "厨余(湿)垃圾"],
    ["帆布袋", "可回收垃圾"],
    ["放大镜", "可回收垃圾"],
    ["粉扑", "其他(干)垃圾"],
    ["甘蔗皮", "其他(干)垃圾"],
    ["干燥剂", "其他(干)垃圾"],
    ["糕点", "厨余(湿)垃圾"],
    ["狗尿垫", "其他(干)垃圾"],
    ["广告单", "可回收垃圾"],
    ["锅", "可回收垃圾"],
    ["果肉", "厨余(湿)垃圾"],
    ["含水银温度计", "有害垃圾"],
    ["含水银血压计", "有害垃圾"],
    ["核桃壳", "其他(干)垃圾"],
    ["化妆品", "其他(干)垃圾"],
    ["灰土", "其他(干)垃圾"],
    ["家电", "可回收垃圾"],
    ["家养绿植", "厨余(湿)垃圾"],
    ["假睫毛", "其他(干)垃圾"],
    ["胶带", "其他(干)垃圾"],
    ["镜子", "其他(干)垃圾"],
    ["旧衣服", "可回收垃圾"],
    ["菌菇", "厨余(湿)垃圾"],
    ["KT板", "可回收垃圾"],
    ["快递纸袋", "可回收垃圾"],
    ["矿物油及其包装", "有害垃圾"],
    ["老鼠药", "有害垃圾"],
    ["利乐包", "可回收垃圾"],
    ["零食包装袋", "其他(干)垃圾"],
    ["榴莲核", "其他(干)垃圾"],
    ["榴莲壳", "其他(干)垃圾"],
    ["炉渣", "其他(干)垃圾"],
    ["卤素灯", "有害垃圾"],
    ["螺丝刀", "可回收垃圾"],
    ["铝箔", "可回收垃圾"],
    ["猫砂", "其他(干)垃圾"],
    ["毛发", "其他(干)垃圾"],
    ["毛巾", "其他(干)垃圾"],
    ["毛绒玩具", "可回收垃圾"],
    ["米面豆制品", "厨余(湿)垃圾"],
    ["棉袄", "可回收垃圾"],
    ["棉被", "可回收垃圾"],
    ["棉签", "其他(干)垃圾"],
    ["面膜", "其他(干)垃圾"],
    ["内衣", "其他(干)垃圾"],
    ["内脏", "厨余(湿)垃圾"],
    ["尼龙制品", "其他(干)垃圾"],
    ["尿不湿", "其他(干)垃圾"],
    ["PE塑料", "可回收垃圾"],
    ["PVC塑料", "可回收垃圾"],
    ["泡沫塑料", "可回收垃圾"],
    ["皮带", "可回收垃圾"],
    ["皮鞋", "可回收垃圾"],
    ["染发剂", "有害垃圾"],
    ["肉", "厨余(湿)垃圾"],
    ["肉干", "厨余(湿)垃圾"],
    ["软果皮", "厨余(湿)垃圾"],
    ["软果籽", "厨余(湿)垃圾"],
    ["伞", "其他(干)垃圾"],
    ["杀虫剂", "有害垃圾"],
    ["湿纸巾", "其他(干)垃圾"],
    ["食品罐桶", "可回收垃圾"],
    ["食用油桶", "可回收垃圾"],
    ["书", "可回收垃圾"],
    ["蔬菜", "厨余(湿)垃圾"],
    ["丝绸制品", "可回收垃圾"],
    ["丝袜", "其他(干)垃圾"],
    ["塑料盒", "可回收垃圾"],
    ["塑料瓶", "可回收垃圾"],
    ["塑料玩具", "可回收垃圾"],
    ["塑料碗盘", "可回收垃圾"],
    ["塑料衣架", "可回收垃圾"],
    ["碎玻璃", "可回收垃圾"],
    ["糖果", "厨余(湿)垃圾"],
    ["陶瓷碗盆", "其他(干)垃圾"],
    ["铁钉", "可回收垃圾"],
    ["铁皮", "可回收垃圾"],
    ["卫生纸", "其他(干)垃圾"],
    ["污损塑料袋", "其他(干)垃圾"],
    ["污损纸张", "其他(干)垃圾"],
    ["五谷杂粮", "厨余(湿)垃圾"],
    ["洗甲水", "有害垃圾"],
    ["虾", "厨余(湿)垃圾"],
    ["虾壳", "厨余(湿)垃圾"],
    ["相片底片", "有害垃圾"],
    ["香菇干", "厨余(湿)垃圾"],
    ["橡皮泥", "其他(干)垃圾"],
    ["小骨/碎骨", "厨余(湿)垃圾"],
    ["小型木制品", "可回收垃圾"],
    ["卸妆棉", "其他(干)垃圾"],
    ["卸妆油", "其他(干)垃圾"],
    ["信封", "可回收垃圾"],
    ["X光片", "有害垃圾"],
    ["亚克力板", "可回收垃圾"],
    ["烟蒂", "其他(干)垃圾"],
    ["药品", "有害垃圾"],
    ["药品内包装", "有害垃圾"],
    ["椰子壳", "其他(干)垃圾"],
    ["一次性餐具", "其他(干)垃圾"],
    ["一次性手套", "其他(干)垃圾"],
    ["一次性纸杯", "其他(干)垃圾"],
    ["易拉罐", "可回收垃圾"],
    ["隐形眼镜", "其他(干)垃圾"],
    ["硬贝壳", "其他(干)垃圾"],
    ["油漆桶", "有害垃圾"],
    ["鱿鱼", "厨余(湿)垃圾"],
    ["鱼", "厨余(湿)垃圾"],
    ["鱼骨", "厨余(湿)垃圾"],
    ["玉米衣", "其他(干)垃圾"],
    ["枕头", "可回收垃圾"],
    ["纸板箱", "可回收垃圾"],
    ["指甲钳", "可回收垃圾"],
    ["指甲油", "有害垃圾"],
    ["中药材", "厨余(湿)垃圾"],
    ["中药药渣", "厨余(湿)垃圾"],
    ["竹制品", "其他(干)垃圾"],
    ["粽叶", "其他(干)垃圾"],
  ];

  Widget _itemBuilder(BuildContext context, int index) {
    if (list[index][1].toString() == "可回收垃圾") {
      return Container(
        // color: const Color(0xffa68a64), // 背景色
        decoration: BoxDecoration(
            // border: new Border.all(color: const Color(0xffa68a64), width: 0.5),
            borderRadius: BorderRadius.circular(10),
            image: DecorationImage(
              fit: BoxFit.fitWidth,
              image: NetworkImage(
                  "https://gimg2.baidu.com/image_search/src=http%3A%2F%2Fp1.music.126.net%2FGwO4OfzOrCvEkCh2AYPGWA%3D%3D%2F109951163553910056.jpg&refer=http%3A%2F%2Fp1.music.126.net&app=2002&size=f9999,10000&q=a80&n=0&g=0n&fmt=jpeg?sec=1633686278&t=aced5d07cad33cfb86bea0ea2c099e5b"
              ),
            )
        ),
        margin: EdgeInsets.fromLTRB(10, 5, 10, 10), // 外边距
        child: Column(
          children: [
            SizedBox(height: 20),
            Flex(
              direction: Axis.horizontal,
              mainAxisAlignment: MainAxisAlignment.start,
              children: [
                Expanded(
                  flex: 1,
                  child: Container(),
                ),
                Expanded(
                    flex: 6,
                    child: Container(
                      child: Text(
                        list[index][0].toString(),
                        style: TextStyle(
                            color: Colors.blueGrey.shade300,
                            fontWeight: FontWeight.w700,
                            fontSize: 20),
                      ),
                    )),
                Expanded(
                    flex: 6,
                    child: Container(
                        child: Text(
                          list[index][1].toString(),
                          textDirection: TextDirection.rtl,
                          style: TextStyle(
                              color: Colors.blueGrey.shade900,
                              fontWeight: FontWeight.w600,
                              fontSize: 16),
                        ))),
                Expanded(flex: 1, child: Container()),
              ],
            ),
            SizedBox(height: 20),
          ],
        ),
      );
    } else if (list[index][1].toString() == "有害垃圾") {
      return Container(
        // color: const Color(0xffa68a64), // 背景色
        decoration: BoxDecoration(
            // border: new Border.all(color: const Color(0xff7f4f24), width: 0.5),
            borderRadius: BorderRadius.circular(10),
            image: DecorationImage(
            fit: BoxFit.fitWidth,
            image: NetworkImage(
              "https://gimg2.baidu.com/image_search/src=http%3A%2F%2Fqqpublic.qpic.cn%2Fqq_public%2F0%2F0-2695319912-B59F67F21CB735C88A2B49C0FC7632EE%2F0%3Ffmt%3Djpg%26size%3D106%26h%3D506%26w%3D900%26ppv%3D1.jpg&refer=http%3A%2F%2Fqqpublic.qpic.cn&app=2002&size=f9999,10000&q=a80&n=0&g=0n&fmt=jpeg?sec=1633686739&t=a20f5e8c286a7d7bf28adc0a7a7cc5de"
            ),
          )
        ),
        margin: EdgeInsets.fromLTRB(10, 5, 10, 10), // 外边距
        child: Column(
          children: [
            SizedBox(height: 20),
            Flex(
              direction: Axis.horizontal,
              mainAxisAlignment: MainAxisAlignment.start,
              children: [
                Expanded(
                  flex: 1,
                  child: Container(),
                ),
                Expanded(
                    flex: 6,
                    child: Container(
                      child: Text(
                        list[index][0].toString(),
                        style: TextStyle(
                            color: const Color(0xffF9D6B0),
                            fontWeight: FontWeight.w600,
                            fontSize: 20),
                      ),
                    )),
                Expanded(
                    flex: 6,
                    child: Container(
                        child: Text(
                          list[index][1].toString(),
                          textDirection: TextDirection.rtl,
                          style: TextStyle(
                              color: const Color(0xffF9D6B0),
                              fontWeight: FontWeight.w500,
                              fontSize: 16),
                        ))),
                Expanded(flex: 1, child: Container()),
              ],
            ),
            SizedBox(height: 20),
          ],
        ),
      );
    } else if (list[index][1].toString() == "其他(干)垃圾") {
      return Container(
        // color: const Color(0xffa68a64), // 背景色
        decoration: BoxDecoration(
            // border: new Border.all(color: const Color(0xffa68a64), width: 0.5),
            borderRadius: BorderRadius.circular(10),
            image: DecorationImage(
              fit: BoxFit.fitWidth,
              image: NetworkImage(
                  "https://gimg2.baidu.com/image_search/src=http%3A%2F%2Fattach.bbs.miui.com%2Fforum%2F201504%2F21%2F212903lrev8ge0aav0eeap.jpg&refer=http%3A%2F%2Fattach.bbs.miui.com&app=2002&size=f9999,10000&q=a80&n=0&g=0n&fmt=jpeg?sec=1633686572&t=40198026bd61612cf9376c8b857dd52d",

            )
        ),),
        margin: EdgeInsets.fromLTRB(10, 5, 10, 10), // 外边距
        child: Column(
          children: [
            SizedBox(height: 20),
            Flex(
              direction: Axis.horizontal,
              mainAxisAlignment: MainAxisAlignment.start,
              children: [
                Expanded(
                  flex: 1,
                  child: Container(),
                ),
                Expanded(
                    flex: 6,
                    child: Container(
                      child: Text(
                        list[index][0].toString(),
                        style: TextStyle(
                            color: Colors.blueGrey.shade100,
                            fontWeight: FontWeight.w600,
                            fontSize: 20),
                      ),
                    )),
                Expanded(
                    flex: 6,
                    child: Container(
                        child: Text(
                          list[index][1].toString(),
                          textDirection: TextDirection.rtl,
                          style: TextStyle(
                              color: Colors.blueGrey.shade900,
                              fontWeight: FontWeight.w400,
                              fontSize: 16),
                        ))),
                Expanded(flex: 1, child: Container()),
              ],
            ),
            SizedBox(height: 20),
          ],
        ),
      );
    } else {
      return Container(
        // color: const Color(0xffa68a64), // 背景色
        decoration: BoxDecoration(
            // border: new Border.all(color: const Color(0xff7f4f24), width: 0.5),
            borderRadius: BorderRadius.circular(10),
            image: DecorationImage(
              fit: BoxFit.fitWidth,
              image: NetworkImage(
    "https://gimg2.baidu.com/image_search/src=http%3A%2F%2Fwww.dabaoku.com%2Fsucaidatu%2Fdongwu%2Fhaididongwu%2F189829.jpg&refer=http%3A%2F%2Fwww.dabaoku.com&app=2002&size=f9999,10000&q=a80&n=0&g=0n&fmt=jpeg?sec=1633686446&t=9dc1d7d48118abdf079d0f13594f9a9b"),
              ),

        ),
        margin: EdgeInsets.fromLTRB(10, 5, 10, 10), // 外边距
        child: Column(
          children: [
            SizedBox(height: 20),
            Flex(
              direction: Axis.horizontal,
              mainAxisAlignment: MainAxisAlignment.start,
              children: [
                Expanded(
                  flex: 1,
                  child: Container(),
                ),
                Expanded(
                    flex: 6,
                    child: Container(
                      child: Text(
                        list[index][0].toString(),
                        style: TextStyle(
                            color: Colors.blueGrey.shade300,
                            fontWeight: FontWeight.w700,
                            fontSize: 20),
                      ),
                    )),
                Expanded(
                    flex: 6,
                    child: Container(
                        child: Text(
                          list[index][1].toString(),
                          textDirection: TextDirection.rtl,
                          style: TextStyle(
                              color: Colors.blueGrey.shade900,
                              fontWeight: FontWeight.w700,
                              fontSize: 16),
                        ))),
                Expanded(flex: 1, child: Container()),
              ],
            ),
            SizedBox(height: 20),
          ],
        ),
      );
    }
  }

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      // backgroundColor:Colors.black87,
      extendBodyBehindAppBar: false,
      appBar: AppBar(
        backgroundColor: Colors.blueGrey,
        title: Text(
          "辞典",
          style: TextStyle(
            fontSize: 20,
          ),
        ),
        centerTitle: true,
        elevation: 5.0,
        // 阴影
      ),
      drawer: DrawLayout(),
      body: Padding(

          padding: EdgeInsets.all(10),
          child: ListView.builder(
            itemBuilder: _itemBuilder,
            itemCount: list.length,
          )),
    );
  }
}
